/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.spring66.tutorial.service.ibatis;

import com.spring66.tutorial.dao.UsersDao;
import com.spring66.tutorial.model.Users;
import com.spring66.tutorial.model.UsersExpression;
import com.spring66.tutorial.service.UserService;
import java.util.List;

/**
 *
 * @author twinp
 */
public class IbatisUserService implements UserService {
    private UsersDao usersDao;
    @Override
    public Users createUser(Users user) {
        usersDao.insert(user);
        //List<Users> users = usersDao.selectByExpression(expression);
        return user;
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public List<Users> getUsers(UsersExpression userEx) {
        //usersDao.selectByExpression(new UserExpressio)
        return usersDao.selectByExpression(userEx);
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void updateUsers(Users user) {
        usersDao.updateByPrimaryKey(user);
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void deleteUser(String userId) {
        usersDao.deleteByPrimaryKey(userId);
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * @return the usersDao
     */
    public UsersDao getUsersDao() {
        return usersDao;
    }

    /**
     * @param usersDao the usersDao to set
     */
    public void setUsersDao(UsersDao usersDao) {
        this.usersDao = usersDao;
    }

}
